package com.saihai.jiankang.ufBmifwqf.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.saihai.common.annotation.Log;
import com.saihai.common.core.controller.BaseController;
import com.saihai.common.core.domain.AjaxResult;
import com.saihai.common.enums.BusinessType;
import com.saihai.jiankang.ufBmifwqf.domain.UfBmifwqf;
import com.saihai.jiankang.ufBmifwqf.service.IUfBmifwqfService;
import com.saihai.common.utils.poi.ExcelUtil;
import com.saihai.common.core.page.TableDataInfo;

/**
 * bmi异常值Controller
 * 
 * @author ruoyi
 * @date 2024-08-30
 */
@RestController
@RequestMapping("/jiankang/ufBmifwqf")
public class UfBmifwqfController extends BaseController
{
    @Autowired
    private IUfBmifwqfService ufBmifwqfService;

    /**
     * 查询bmi异常值列表
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufBmifwqf:list')")
    @GetMapping("/list")
    public TableDataInfo list(UfBmifwqf ufBmifwqf)
    {
        startPage();
        List<UfBmifwqf> list = ufBmifwqfService.selectUfBmifwqfList(ufBmifwqf);
        return getDataTable(list);
    }

    /**
     * 导出bmi异常值列表
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufBmifwqf:export')")
    @Log(title = "bmi异常值", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, UfBmifwqf ufBmifwqf)
    {
        List<UfBmifwqf> list = ufBmifwqfService.selectUfBmifwqfList(ufBmifwqf);
        ExcelUtil<UfBmifwqf> util = new ExcelUtil<UfBmifwqf>(UfBmifwqf.class);
        util.exportExcel(response, list, "bmi异常值数据");
    }

    /**
     * 获取bmi异常值详细信息
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufBmifwqf:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ufBmifwqfService.selectUfBmifwqfById(id));
    }

    /**
     * 新增bmi异常值
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufBmifwqf:add')")
    @Log(title = "bmi异常值", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UfBmifwqf ufBmifwqf)
    {
        return toAjax(ufBmifwqfService.insertUfBmifwqf(ufBmifwqf));
    }

    /**
     * 修改bmi异常值
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufBmifwqf:edit')")
    @Log(title = "bmi异常值", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UfBmifwqf ufBmifwqf)
    {
        return toAjax(ufBmifwqfService.updateUfBmifwqf(ufBmifwqf));
    }

    /**
     * 删除bmi异常值
     */
    @PreAuthorize("@ss.hasPermi('jiankang:ufBmifwqf:remove')")
    @Log(title = "bmi异常值", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ufBmifwqfService.deleteUfBmifwqfByIds(ids));
    }
}
